import { get, post } from '../http'

// 获取公钥
export const getPlatformPubKey = async (paylaod?: any) => {
  return await get('/user/v1/config/getPlatformPubKey', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 账密登录
export const loginByPwd = async (paylaod?: any) => {
  return post('/user/v1/login/loginByPwd', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 用户菜单
export const findMenuByParam = async (paylaod?: any) => {
  return get('/user/v1/menu/findMenuByParam', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 获取当前用户菜单信息
export const getCurrentUserMenu = async (paylaod?: any) => {
  return get('/user/v1/user/getCurrentUserMenu', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 根据编号查询租户
export const getCompanyByCode = async (paylaod?: any) => {
  return get('/user/v1/company/getCompanyByCode', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 获取当前用户授权信息
export const getCurrentUserAuthCode = async (paylaod?: any) => {
  return get('/user/v1/user/getCurrentUserAuthCode', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 根据用户id登录
export const loginByUserId = async (paylaod?: any) => {
  return post('/user/v1/login/loginByUserId', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 钉钉扫码授权登录
export const loginByAuthCode = async (paylaod?: any) => {
  return get('/user/v1/login/ding/callback/auth', paylaod)
    .then((res) => res)
    .catch(() => false)
}
